// $URL: http://mingw-lib.googlecode.com/svn/trunk/working/yt01/widget.h $
// $Rev: 62 $
// $Author: akio.miyoshi $
// $Date:: 2010-05-05 14:21:46 +0000#$

#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QtCore>
#include "nam.h"

class Rec4U : public QObject {
    Q_OBJECT
public:
    QString title;
    QString link;
    QString guid;
    QString media_content;
    QString media_thumbnail;
    QString pubDate;
    QString description;
    friend QDebug operator<< (QDebug d, const Rec4U &model)
    {
        d << "Hello world!";
        d << "title:" << model.title;
        return d;
    }
};

//QDebug operator<< (QDebug d, const Rec4U &model) {
//    d << "Hello world!";
//    return d;
//}

namespace Ui {
    class Widget;
}

class Widget : public QWidget {
    Q_OBJECT
public:
    Widget(QWidget *parent = 0);
    ~Widget();

protected:
    void changeEvent(QEvent *e);

private:
    Ui::Widget *ui;
    NetworkAccessManager *nam;
    void setDesktopFile(QFile &file, QString name);
    void saveDesktopFile(QString name, QByteArray bytes);
    void backupXmlBody(QByteArray bytes);
    void parseXml(QByteArray &xml);
    void parseXmlFor4U(QByteArray &xml);

private slots:
    void on_pushButton_4_clicked();
    void on_pushButton_3_clicked();
    void on_pushButton_2_clicked();
    void on_pushButton_clicked();
};

#endif // WIDGET_H
